﻿<?xml version="1.0" encoding="utf-8"?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="NBooks.Core.Models" assembly="NBooks.Core">
	<class name="SalesReceipt" table="sales_receipts">
		<id name="Id" column="id">
			<generator class="identity" />
		</id>
		<property name="Date" column="date" />
		<many-to-one name="VehicleTrip" class="VehicleTrip" column="vehicle_trip_id" />
		<many-to-one name="Account" class="Account" column="account_id" />
		<many-to-one name="Customer" class="Customer" column="customer_id" />
		<bag name="Items" inverse="true" cascade="all-delete-orphan">
			<key column="sales_receipt_id" />
			<one-to-many class="SalesReceiptItem" />
		</bag>
	</class>
	<class name="SalesReceiptItem" table="sales_receipts_items">
		<id name="Id" column="id">
			<generator class="identity" />
		</id>
		<many-to-one name="Receipt" class="SalesReceipt" column="sales_receipt_id" />
		<many-to-one name="Item" class="Item" column="item_id" />
		<property name="Quantity" column="quantity" />
		<property name="Rate" column="rate" />
	</class>
</hibernate-mapping>